package com.itheima.zy;


public class Test2 {
    public static void main(String[] args) {
        /*需求:
	    现有一个整数数组{100,50,90,60,80,70}。请编写代码，计算数组中的所有元素的和并打印。*/

        int[] num = {100, 50, 90, 60, 80, 70};
        int he = 0;
        for (int i = 0; i < num.length; i++) {
            he += num[i];
            System.out.println(num[i]);
        }
        System.out.println("所有元素的和" + he);

    }
}
